package com.tm.servicemsm.demos;

/**
 * 2024/7/20  库存类
 */
public class DrugInventory {
    private int quantity;
    private Drug drug;

    public DrugInventory(Drug drug,int quantity){
        this.drug=drug;
        this.quantity=quantity;
    }

    //验收药品
    public void receiveDrug(int receivedQuantity){
        this.quantity+=receivedQuantity;
        // 这里可以添加积分规则逻辑
    }

    //入库药品
    public void stockDrug(int stockedQuantity){
         this.quantity+=stockedQuantity;
    }

    //盘点药品
    public void inventoryCheck(){
    }

    //查看库存
    public int checkStock(){
        return this.quantity;
    }

    //出库药品
    public void issueDrug(int issuedQuantity){
        this.quantity=issuedQuantity;
    }

    //使用示列
    public class DrugManagementSystem{
        public static void main(String[] args) {
            Drug drug = new Drug("处方药A");
            DrugInventory inventory = new DrugInventory(drug, 0);

            //验收药品
            inventory.receiveDrug(100);

            //入库药品
            inventory.stockDrug(200);

            //盘点药品
            inventory.inventoryCheck();

            //查看库存
            int checkStock = inventory.checkStock();

            //出库药品
            inventory.issueDrug(50);
        }
    }
}
